package slot_machine

import (
	"github.com/spf13/cast"
	"sync"
)

type User struct {
	Uid      int      // 用户id
	potBet   sync.Map // 本手底池下注, map[int]uint64, key: potId
	TotalBet int64    // 本手下注总额(精简版)
}

func (u *User) setPotBet(potId int, chips int64) {
	bet := u.getPotBet(potId)
	u.potBet.Store(potId, bet+chips)
	u.TotalBet += chips
}

func (u *User) getPotBet(potId int) (bet int64) {
	if v, ok := u.potBet.Load(potId); ok {
		bet = cast.ToInt64(v)
	}
	return
}
